var app =new Vue({
    el:"#container",
    data:{
        NurWork:[],
        room:[]
    },
    mounted(){
        this.findAllNur();
        this.queryAllRoom();
    },
    methods:{
        findAllNur(){
            axios({
                url:"yly-api/admin/queryAllNursingWorkers",
                method:"get",
                headers:{"token":localStorage.token,"url":window.location.pathname}
            }).then(function (res) {
                console.log(res.data);
                if (res.data.code==200){
                    app.NurWork=res.data.data;
                }else if (res.data.code==500){
                    location.href="500.html";
                }
            }).catch(function (error) {
                console.log(error.response.status);
                if (error.response.status==401){
                    alert("权限不足，无法访问!");
                    location.href="login.html";
                }else if (error.response.status==403){
                    alert("用户已过期，请重新登录！");
                    localStorage.token=null;
                    location.href="login.html";
                }
            })
        },
        queryAllRoom(){
            axios({
                url:"yly-api/admin/queryRoomNumber",
                method:"get",
                headers:{"token":localStorage.token,"url":window.location.pathname}
            }).then(function (res) {
                console.log(res.data);
                if (res.data.code==200){
                    app.room=res.data.data;
                }else if (res.data.code==500){
                    location.href="500.html";
                }
            }).catch(function (error) {
                console.log(error.response.status);
                if (error.response.status==401){
                    alert("权限不足，无法访问!");
                    location.href="login.html";
                }else if (error.response.status==403){
                    alert("用户已过期，请重新登录！");
                    localStorage.token=null;
                    location.href="login.html";
                }
            })
        }
    }
});